public class Hello6 {
    public static void main(String[] args) {
        //算数运算符
        //test();
        //关系运算符
        //test1();
        //逻辑运算符
        //test2();
        //赋值运算符
        test3();
    }

    //算数运算符
    public static void test() {
        int a = 1;
        int b = 2;
        System.out.println(a+b);
        System.out.println(a-b);
        System.out.println(a*b);
        System.out.println(a/b);
        System.out.println(a%b);
        //a++表示取a的地址,先把a的值放到寄存器中,然后再增加内存中a的值;
        System.out.println(a++);
        System.out.println(a);
        //++a表示取a的地址,然后先增加内存中a的值,然后再把a的值放在寄存器中;
        System.out.println(++a);
        System.out.println(a);
    }

    //关系运算符
    public static void test1() {
        int a = 1;
        int b = 1;
        if (a!=b) {
            System.out.println("相等");
        } else {
            System.out.println("不相等");
        }
    }

    //逻辑运算符
    public static void test2() {
        int a = 1;
        int b = 1;
        int c = 2;
        if (a==b && !(a==c)) {
            System.out.println("逻辑相等");
        } else {
            System.out.println("逻辑不相等");
        }
    }

    //赋值运算符
    public static void test3() {
        int a = 1;
        int b = 2;
        a+=b;
        //b-=a;
        //b*=a;
        //b/=a;
        //b%=a;
        System.out.println(a);
    }
}
